#!/bin/bash

USER="ywzt"
PASSWORD="Fjywzt@)@!server2021"
HOST="rm-6zsweap3jx27j95qdgo.mysql.rds.ops.cloud.fjtic.cn"
PORT="3307"
TARGET_DIR="/data/chenl/"

# 获取所有数据库的名称
DB_NAMES=$(mysql --user=$USER --password=$PASSWORD --host=$HOST --port=$PORT -e "SHOW DATABASES;" | grep -vE 'Database|information_schema|mysql|performance_schema|sys')

for DB_NAME in $DB_NAMES; do
    mysqldump --user=$USER --password=$PASSWORD --host=$HOST --port=$PORT --no-data $DB_NAME > "$TARGET_DIR/${DB_NAME}_structure.sql"
done